<div class="cont konw_pro">
    <style type="text/css">
        .ui.form .inline.fields>label {
            white-space: nowrap;
        }
        
        .ui.modal .ui.form .inline.fields {
            margin: 0;
            margin-bottom: 0.5em;
        }
        
        .ui.modal .ui.pointing.menu {
            margin-bottom: 1em;
            background: transparent;
            border: 1px solid rgba(34, 36, 38, .15)
        }
        
        button.normal_btn {
            border-radius: 16px;
            width: 84px;
            height: 32px;
            border: none;
            color: #fff;
            margin-right: 14px;
            font-size: 14px;
            background: #39A0ED;
            outline: none;
        }
        
        button.normal_btn:hover {
            background: #078ef2;
        }
        
        .onload_checkbox {
            margin: 0 0.4em 0 1.2em;
        }
        
        .onload_checkbox {
            margin: 0 1em;
        }
        
        .ui.form textarea {
            padding-left: 0.5em;
            padding-right: 0.5em;
        }
        
        .addfile {
            padding: 2px 0 2px 8px;
            background: #eee;
            margin-left: 5px;
        }
        
        .konw_pro .padded.grid {
            background: #fff;
            border-radius: 4px;
            box-shadow: 2px 2px 2px rgba(0, 27, 64, 0.1);
            min-height: 850px;
        }
        
        .konw_pro .add_post {
            margin-bottom: 16px;
        }
        
        .cover_img {
            margin-left: 74px;
        }
        
        .ui.card {
            text-align: center;
        }
        
        .ui.cards>.card {
            width: 256px;
            display: inline-block;
            color: #666;
        }
        
        .left.col {
            width: 290px;
            float: left;
            border-right: 1px dashed #e5e5e5;
        }
        
        .treemenu {
            margin-top: 10px;
        }
        
        .header {
            font-size: 16px;
            line-height: 32px;
        }
        
        .header img {
            width: 32px;
            vertical-align: middle;
            margin-right: 10px;
        }
        
        .ui.grid>* {
            padding: 12px;
        }
        
        .right.col {
            width: calc(100% - 290px);
        }
        
        .cardbox {
            text-align: center;
        }
        
        .ui.card {
            display: inline-block;
            margin: 10px;
            width: 263px;
            min-height: 263px;
            text-align: left;
        }
        
        .kn_center {
            margin: 80px auto 0;
            width: 780px;
        }
        
        .ui.accordion:not(.styled) .accordion .title~.content:not(.ui),
        .ui.accordion:not(.styled) .title~.content:not(.ui) {
            padding: 0;
        }
        
        .ui.accordion .accordion {
            margin: 0;
        }
        
        .ui.accordion .checked.title:not(.ui) {
            color: #39a0ed;
        }
        
        a.menu_links {
            cursor: pointer;
        }
        
        .minus.icon {
            margin: -2px 5px 0;
        }
    </style>
    <div class="position">
        <img alt="位置图标" src="dist/images/position.png" />知识库&gt;知识点
    </div>
    <div class="ui padded grid">
        <!--知识库管理部门-->
        <div class="left col">
            <div class="header"><img src="dist/images/know_list.png" alt="" />知识树 </div>
            <div class="treemenu boxed">
            </div>
        </div>
        <!--知识库文章-->
        <div class="right col meuns_table">
            <div class="kn_center" ng-if="is_picture ==1"><img src="dist/images/knowledge_center.png" /></div>
            <div ng-if="is_picture == 2">
                <div class="add_post clearfix">
                    <div class="header fl">
                        <img src="dist/images/know_post.png" />知识点
                    </div>
                    <button class="fr normal_btn add" ng-hide="is_hide == 2" ng-click="AddKnowledgeProperty()"><i class="add icon"></i> 添加</button>

                    <!--start-->
                    <div class="ui dropdown  item " id="menu" ng-click="operation()">
                        <button class="fr normal_btn add" ng-hide="is_hide == 2" ng-click="operation()"> 移动至...</button>
                        <!--<div class="ui button" ng-click="operation()" style="padding: 7px 20px; ">合同管理</div>-->
                        <div class="menu">
                            <!--   <div class="item" ng-click="look_over(vlist.contract_id)">        合同详情 </div> -->
                            <div class="item" ng-click="showContractDetail(vlist.contract_id)">合同详情</div>
                            <div class="item" ng-click="print_show(vlist.contract_id)" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' "> 打印合同 </div>
                            <div class="item" ng-click="mail_contract()" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' "> 合同邮寄 </div>
                            <div class="item" ng-click="econtract(vlist.contract_id)" ng-if="vlist.state==0||vlist.state ==4">电子签订</div>
                            <div class="item" ng-click="editor_show(vlist.contract_id)" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' "> 编辑合同 </div>
                            <div class="item" ng-click="cancel_remind(vlist.contract_id)" ng-if="vlist.state == '1' || vlist.state == '0' || vlist.state == '4' "> 取消合同 </div>
                        </div>
                    </div>
                    <!--end-->
                </div>
                <table class="ui yellow celled striped table" style="min-width: 800px;">
                    <thead>
                        <tr>
                            <th style="width:160px;">发布时间</th>
                            <th>文章标题</th>
                            <th style="width:160px;">作者</th>
                            <th style="width:100px;">所属部门</th>
                            <th style="width:80px">类型</th>
                            <th style="width:100px; text-align: center;">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="knowledge in knowledgepropertysource">
                            <td>{{knowledge.create_time}}</td>
                            <td title="点击查看全部文章"><a href="javascript:;" ng-click="openDetail(viewknowledgenode,knowledge.knowledge_id,knowledge.msg_type,knowledge.knowledge_spot_id,loginuserid)" style="cursor: pointer;" class="menu_links">{{knowledge.title}}</a><a href="javascript:;"
                                    ng-show="knowledge.msg_type == 2" ng-click="DownSecondTabFile(knowledge.id)"><i class="download icon"></i></a></td>
                            <td>{{knowledge.pen_name}}</td>
                            <td>{{knowledge.sector_name}}</td>
                            <td ng-if="knowledge.msg_type == 1">图文</td>
                            <td ng-if="knowledge.msg_type == 2">文件</td>
                            <td ng-if="knowledge.msg_type == 3">外链</td>
                            <td style="text-align: center;"> <a href="javascript:;" ng-hide="knowledge.is_hide" title="" ng-click="editknowledge(knowledge.knowledge_id,knowledge.msg_type)">编辑</a>
                                <a href="javascript:;" ng-hide="knowledge.is_delete" title="" ng-click="delknowledge(knowledge.knowledge_id,knowledge.msg_type,knowledge.knowledge_spot_id)">删除</a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="ui pagination menu fr " ng-show="knowledgeproperty.pageAll > 1" class="ui borderless pagination menu" jspagination page-object="knowledgeproperty" page-func="KnowledgeDatalist"></div>
            </div>

        </div>
    </div>
    <!--添加知识-->
    <div class="ui add modal">
        <div class="header_h4">添加知识</div>
        <div class="content">
            <div class="ui form">
                <form name="FormKnowledge" id="KnowLedge_id">
                    <div class="ui three item pointing menu">
                        <a class="active item" id="firsttab" data-tab="first" ng-click="tab('first')"><i class="newspaper icon"></i>图文</a>
                        <a class="item" id="secondtab" data-tab="second" ng-click="tab('second')"><i class="sticky note outline icon"></i>文件</a>
                        <a class="item" id="thirdtab" data-tab="third" ng-click="tab('third')"><i class="linkify icon"></i>链接</a>
                    </div>
                    <!--图文部分-->
                    <div class="ui active tab" data-tab="first">
                        <div class="inline fields">
                            <label style="margin-right: 2em;">当前位置</label> {{shownodepath}}
                        </div>
                        <div class="inline field required">
                            <label>文章标题</label>
                            <input type="text" placeholder="文章标题" name="articaltitle" ng-model="param.title" style="width: 40%">
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 2em;">封面图片</label>
                            <button class="cont_f_btn1" ng-model="img" ng-change="addImgChange(img)" ngf-select>上传图片</button>
                            <div class="ui checkbox" style="margin-left:10px">
                                <input type="checkbox" name="addfirsttabchk" ng-click="is_display()" ng-disabled="chkdisabled">
                                <label>是否在正文显示</label>
                            </div>
                            <!--<input type="checkbox" name="addfirsttabchk" ng-click="is_display()" class="ui checkbox">
                            <label>是否在正文显示</label>-->
                            <div class="ui icon message" ng-show="is_uploadingimg">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline fields">
                            <div ng-show='img.path' class="cover_img">
                                <div class="add_img">
                                    <img ng-src="{{img.path}}" width="108px" height="108px" />
                                    <div class="x_icon" ng-click="delFirstImg()"></div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field required">
                            <label>文章作者</label>
                            <input type="text" placeholder="文章作者" name="articalauthor" ng-model="param.author" style="width: 40%">
                        </div>
                        <div class="field">
                            <label>摘要上传</label>
                            <textarea ng-model="param.abstract" rows="2" name="articalabstract"></textarea>
                        </div>
                        <div class="field required">
                            <label>文章正文</label>
                            <div id="add_tempaltevalue" name="articaltemplete" ng-model="param.templete" contenteditable ng-Model="richtxtAdd" style="height:200px;"></div>
                            <input type="hidden" id="add_tempalte" name="add_tempalte" />
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 1.2em;">附件上传</label>
                            <button class="cont_f_btn1" ng-model="file" ng-change="addChange(file)" ngf-select name="import_file" ngf-pattern="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-accept="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-max-size="20MB">上传附件</button>
                            <div ng-repeat="addfile in addfilesparam.addfiles" class="fl addfile">
                                <span type='text'>{{addfile.name}}</span><i class="delete icon" ng-click="delFile()"></i>
                            </div>
                            <div class="ui icon message" ng-show="is_uploading">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field">
                            <label>原文链接</label>
                            <input type="text" placeholder="原文链接" name="articalurl" ng-model="param.url" style="width: 40%">
                        </div>
                    </div>
                    <!--文件部分-->
                    <div class="ui tab" data-tab="second">
                        <div class="inline fields"><label style="margin-right: 2em;">当前位置</label>{{shownodepath}}</div>
                        <div class="inline fields" style="margin: 10px 0;">
                            <label style="margin-right: 2em;">附件上传</label>
                            <button ng-model="transfile" ng-change="addUpload(transfile)" ngf-select name="import_file" ngf-pattern="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-accept="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-max-size="20MB">上传附件</button>
                            <span type='text' style="margin-left: 8px;">{{uploadfile.name}}</span>

                            <!--<div class="inline field required">
                                <label class="fl">附件上传</label>
                                <div type='text' id="secondfile" name="fileup" class="fl addfile">{{uploadfile.name}}</div>
                            </div>-->

                            <div class="field" style="margin-left:10px">
                                <div id="add_sty"></div>
                            </div>
                            <div class="ui icon message" ng-show="is_uploading">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field required">
                            <label>文件名称</label>
                            <input type="text" placeholder="文件名称" name="secondfilename" ng-model="param.filetitle" style="width: 40%">
                        </div>
                    </div>
                    <!--链接部分-->
                    <div class="ui tab" data-tab="third">
                        <div class="inline fields"><label style="margin-right: 2em;">当前位置</label>{{shownodepath}}</div>
                        <div class="inline field required">
                            <label>文章标题</label>
                            <input type="text" placeholder="文章标题" name="thirdarticaltitle" ng-model="param.urltitle" style="width: 40%">
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 2em;">封面图片</label>
                            <button class="cont_f_btn1" ng-model="urlimg" ng-change="addUrlImgChange(urlimg)" ngf-select>上传图片</button>

                            <div class="ui checkbox" style="margin-left:10px">
                                <input type="checkbox" name="addthirdtabchk" ng-click="thirdtabcheckbox()" ng-disabled="thirdchkdisabled">
                                <label>是否在正文显示</label>
                            </div>
                            <!--<input type="checkbox" name="addthirdtabchk" class="onload_checkbox" ng-click="thirdtabcheckbox()">
                            <label>是否在正文显示</label>-->
                            <div class="ui icon message" ng-show="is_uploadingimg">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline fields">
                            <div ng-show='urlfirstimg' class="cover_img">
                                <div class="add_img">
                                    <img ng-src="{{urlfirstimg.path}}" width="108px" height="108px" />
                                    <div class="x_icon" ng-click="delFirstImg()"></div>
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <label>摘要上传</label>
                            <textarea ng-model='param.urlabstract' name="thirdarticalabstract"></textarea>
                        </div>
                        <div class="inline field required">
                            <label>原文链接</label>
                            <input type="text" placeholder="原文链接" name="thirdarticalurl" ng-model="param.outerUrl" style="width: 40%">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="actions">
            <div class="ui green button positive">确定</div>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>

    <div class="ui edit modal">
        <div class="header_h4">编辑素材</div>
        <div class="content">
            <div class="ui form">
                <form name="FormKnowledge" id="FirstKnowLedge_id">
                    <!--图文部分-->
                    <div class="inline fields"><label style="margin-right: 2em;">当前位置</label>{{shownodepath}}</div>
                    <div ng-show="tab.display == 1">
                        <div class="inline field required">
                            <label>文章标题</label>
                            <input type="text" placeholder="文章标题" name="editarticaltitle" ng-model="editparam.title" style="width: 40%">
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 2em;">封面图片</label>
                            <button class="cont_f_btn1" ng-model="editimage" ng-change="editImgChange(editimage)" ngf-select>上传图片</button>
                            <div class="ui checkbox" style="margin-left:10px">
                                <input type="checkbox" name="firsteditcheckbox" ng-click="editchecked()" ng-disabled="editchkdisabled">
                                <label>是否在正文显示</label>
                            </div>
                            <!--<input type="checkbox" class="onload_checkbox" name="firsteditcheckbox" ng-click="editchecked()">
                            <label>是否在正文显示</label>-->
                            <div class="ui icon message" ng-show="is_edituploadingimg">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline fields">
                            <div class="cover_img" ng-show='editimage.path'>
                                <div class="add_img">
                                    <img ng-src="{{editimage.path}}" width="108px" height="108px" />
                                    <div class="x_icon" ng-click="delFirstImg()"></div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field required">
                            <label>文章作者</label>
                            <input type="text" placeholder="文章作者" name="editarticalauthor" ng-model="editparam.pen_name" style="width: 40%">
                        </div>
                        <div class="field">
                            <label>摘要上传</label>
                            <textarea ng-model="editparam.abstract" name="editarticalabstract" rows="2"></textarea>
                        </div>
                        <div class="field required">
                            <label>文章正文</label>
                            <div id="edit_tempaltevalue" ng-model="editparam.content" name="editarticaltemplete" contenteditable ng-Model="richtxtAdd" style="height:200px;"></div>
                            <input type="hidden" id="edit_tempalte" name="edit_tempalte" />
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 1.2em;">附件上传</label>
                            <button class="cont_f_btn1" ng-model="editfileupload" ng-change="addeditchange(editfileupload)" ngf-select name="import_file" ngf-pattern="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-accept="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'"
                                ngf-max-size="20MB">上传附件</button>
                            <div ng-repeat="file in editfilesparam.fileEdit" class="fl addfile">
                                <span type='text'>{{file.name}}</span><i class="delete icon" ng-click="delEditFile()"></i>
                            </div>
                            <div class="ui error message" ng-show="import_pays_error">
                                <div class="header">上传错误</div>
                                <p>{{import_pays_error}}</p>
                            </div>
                            <div class="ui icon message" ng-show="is_edituploading">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field">
                            <label>原文链接</label>
                            <input type="text" placeholder="原文链接" name="editfirsttaburl" ng-model="editparam.artical_url" style="width: 40%">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="actions">
            <div class="ui green button positive">确定</div>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>

    <div class="ui secondedit modal">
        <div class="header_h4">编辑素材</div>
        <div class="content">
            <div class="ui form">
                <form id="SecondEditKnowLedge_id">
                    <!--文件部分-->
                    <div ng-show="tab.display == 2">
                        <div class="inline fields" style="margin: 10px 0">
                            <label style="margin-right: 2em;">附件上传</label>
                            <button ng-model="secondTabFile" ng-change="addUploadSecondTab(secondTabFile)" ngf-select name="import_file" ngf-pattern="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-accept="'.txt,.pdf,.zip,.doc,.ppt,.xls,.docx,.pptx,.xlsx'" ngf-max-size="20MB">上传附件</button>
                            <span type='text' style="margin-left: 4px;">{{secondTabFile.name}}</span>
                            <div class="field" style="margin-left:8px">
                                <div id="edit_sty"></div>
                            </div>
                            <div class="ui icon message" ng-show="is_edituploading">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline field required">
                            <label>文件名称</label>
                            <input type="text" placeholder="文件名称" name="editsecond" ng-model="editparamSecondTab.title" style="width: 40%">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="actions">
            <div class="ui green button positive">确定</div>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>

    <div class="ui thirdedit modal">
        <div class="header_h4">编辑素材</div>
        <div class="content">
            <div class="ui form">
                <form id="ThirdEditKnowLedge_id">
                    <!--链接部分-->
                    <div ng-show="tab.display == 3">
                        <div class="inline field required">
                            <label>文章标题</label>
                            <input type="text" placeholder="文章标题" name="editthirdarticaltitle" ng-model="thirdparam.title" style="width: 40%">
                        </div>
                        <div class="inline fields">
                            <label style="margin-right: 2em;">封面图片</label>
                            <button class="cont_f_btn1" ng-model="thirdurlimg" ng-change="editUrlImgChange(thirdurlimg)" ngf-select>上传图片</button>
                            <!--<input type="checkbox" name="thirdcheckbox" ng-click="editthirdtabcheckbox()">
                            <label>是否在正文显示</label>-->
                            <div class="ui checkbox" style="margin-left:10px">
                                <input type="checkbox" name="thirdcheckbox" ng-click="editthirdtabcheckbox()" ng-disabled="editthirdchkdisabled">
                                <label>是否在正文显示</label>
                            </div>
                            <div class="ui icon message" ng-show="is_edituploadingimg">
                                <i class="notched circle loading icon"></i>
                                <div class="content">
                                    <div class="header">请耐心等待，文件正在上传中....</div>
                                </div>
                            </div>
                        </div>
                        <div class="inline fields">
                            <div ng-show='thirdurlimg.path' class="cover_img">
                                <div class="add_img">
                                    <img ng-src="{{thirdurlimg.path}}" width="108px" height="108px" />
                                    <div class="x_icon" ng-click="delFirstImg()"></div>
                                </div>
                            </div>
                        </div>
                        <div class="field">
                            <label>摘要上传</label>
                            <textarea ng-model='thirdparam.abstract' name="editthirdarticalabstract"></textarea>
                        </div>
                        <div class="inline field required">
                            <label>原文链接</label>
                            <input type="text" placeholder="原文链接" name="editthirdarticalurl" ng-model="thirdparam.artical_url" style="width: 40%">
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="actions">
            <div class="ui green button positive">确定</div>
            <button class="ui grey button negative">取消</button>
        </div>
    </div>
</div>

<!-- delete form is beginnig -->
<div class="ui modal modal3" id="knowledgeproperty_del">
    <div class="header" style="text-align: center;">删除知识库文章</div>
    <div class="content" style="text-align: center;">
        <i class="huge blue help circle icon"></i>
        <p style="padding-top: 15px;"></p>
    </div>
    <div class="actions" style="text-align: center;">
        <div class="ui positive button">确定</div>
        <button class="ui grey button negative">取消</button>
    </div>
</div>
<!-- delete form is the end -->
<!--add success-->
<div class="ui modal modal1" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">添加成功</p>
    </div>
</div>
<!--add success-->
<div class="ui modal modal2" style="text-align: center;">
    <div class="header center aligned">提示</div>
    <div class="content center aligned">
        <i class="huge red remove circle outline icon"></i>
        <p style="padding-top: 15px;">添加失败</p>
    </div>
</div>
<!--编辑成功-->
<div class="ui small modal editOk" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge green check circle outline icon"></i>
        <p style="padding-top: 15px;">编辑成功</p>
    </div>
</div>
<!--编辑失败-->
<div class="ui modal editFail" style="text-align: center;">
    <div class="header">提示</div>
    <div class="content">
        <i class="huge red warning outline icon"></i>
        <p style="padding-top: 15px;">编辑失败</p>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('.ui.buttons .button').on('click', function() {
            $(this).addClass('positive').siblings().removeClass('positive');
        });
        //添加文章
        $('button.add').click(function() {
                $('.addKonwledge.modal').modal('show');
            })
            //修改文章
        $('button.edit').click(function() {
            $('.editKonwledge.modal').modal('show');
        })
        $('.ui.accordion').find('.accordion').css("marginLeft", "20px");
        //图文，文件，外链切换
        $('.menu .item').tab();
        // 把数组tree按内容放到tree里面
    })

    $(function() {
        $('.ui.dropdown').dropdown();

        $.fn.form.settings.rules.firsttab = function() {
            var firsttab = this[0].value;
            var firsttranstab = $('#firsttab').hasClass('active');
            var res;
            if (firsttranstab) {
                if (firsttab) {
                    res = true;
                } else {
                    res = false;
                }
            } else {
                res = true;
            }
            return res;
        }

        $.fn.form.settings.rules.firsttabrichcontent = function() {
            var firsttranstab = $('#firsttab').hasClass('active');
            var res;
            if (firsttranstab) {
                if ($('#add_tempalte').val()) {
                    res = true;
                } else {
                    res = false;
                }
            } else {
                res = true;
            }
            return res;
        }

        $.fn.form.settings.rules.editfirsttabrichcontent = function() {
            var firsttranstab = $('#firsttab').hasClass('active');
            var res;
            if (firsttranstab) {
                if ($('#edit_tempalte').val()) {
                    res = true;
                } else {
                    res = false;
                }
            } else {
                res = true;
            }
            return res;
        }

        $.fn.form.settings.rules.firsttaburl = function() {
            var firsttaburl = this[0].value;
            var firsttranstaburl = $('#firsttab').hasClass('active');
            var resurl;
            if (firsttranstaburl) {
                if (firsttaburl) {
                    var urlregex = new RegExp(
                        "^(http:\/\/|https:\/\/|ftp:\/\/){1}([0-9A-Za-z]+\.)");
                    return urlregex.test(firsttaburl);
                } else {
                    return true;
                }
            } else {
                resurl = true;
            }
            return resurl;
        }

        $.fn.form.settings.rules.edittaburl = function() {
            var firsttaburl = this[0].value;
            var resurl;
            if (firsttaburl) {
                var urlregex = new RegExp(
                    "^(http:\/\/|https:\/\/|ftp:\/\/){1}([0-9A-Za-z]+\.)");
                return urlregex.test(firsttaburl);
            } else {
                return true;
            }
            return resurl;
        }

        $.fn.form.settings.rules.thirdtaburl = function() {
            var thirdtaburl = this[0].value;
            var thirdtranstaburl = $('#thirdtab').hasClass('active');
            var resurl;
            if (thirdtranstaburl) {
                if (thirdtaburl) {
                    var urlregex = new RegExp(
                        "^(http:\/\/|https:\/\/|ftp:\/\/){1}([0-9A-Za-z]+\.)");
                    return urlregex.test(thirdtaburl);
                } else {
                    resurl = false;
                }
            } else {
                resurl = true;
            }
            return resurl;
        }

        $.fn.form.settings.rules.secondtab = function() {
            var secondtab = this[0].value;
            var secondtranstab = $('#secondtab').hasClass('active');
            var secondres;
            if (secondtranstab) {
                if (secondtab) {
                    secondres = true;
                } else {
                    secondres = false;
                }
            } else {
                secondres = true;
            }
            return secondres;
        }

        // $.fn.form.settings.rules.file_exist = function() {
        //     var file;
        //     $.ajax({
        //         method: "GET",
        //         url: "/Admin/Knowledgeproperty/is_file",
        //         success: function(msg) {
        //             if (msg === 'true') {
        //                 file = true;
        //             } else {
        //                 file = false;
        //             }
        //         },
        //         async: false
        //     });

        // }

        $.fn.form.settings.rules.thirdtab = function() {
            var thirdtab = this[0].value;
            var thirdtranstab = $('#thirdtab').hasClass('active');
            var thirdres;
            if (thirdtranstab) {
                if (thirdtab) {
                    thirdres = true;
                } else {
                    thirdres = false;
                }
            } else {
                thirdres = true;
            }
            return thirdres;
        }

        $.fn.form.settings.rules.firstmaxlength = function() {
            var firsttab = this[0].value;
            var firsttranstab = $('#firsttab').hasClass('active');
            var res;
            if (firsttranstab) {
                if (firsttab && firsttab.length < 50) {
                    res = true;
                } else {
                    res = false;
                }
            } else {
                res = true;
            }
            return res;
        }

        $.fn.form.settings.rules.secondmaxlength = function() {
            var secondtab = this[0].value;
            var secondtranstab = $('#secondtab').hasClass('active');
            var res;
            if (secondtranstab) {
                if (secondtab && secondtab.length < 50) {
                    res = true;
                } else {
                    res = false;
                }
            } else {
                res = true;
            }
            return res;
        }

        $.fn.form.settings.rules.thirdmaxlength = function() {
            var thirdtab = this[0].value;
            var thirdtranstab = $('#thirdtab').hasClass('active');
            var thirdres;
            if (thirdtranstab) {
                if (thirdtab && thirdtab.length < 50) {
                    thirdres = true;
                } else {
                    thirdres = false;
                }
            } else {
                thirdres = true;
            }
            return thirdres;
        }

        $('#KnowLedge_id').form({
            on: 'blur',
            inline: true,
            fields: {
                articaltitle: {
                    identifier: 'articaltitle',
                    rules: [{
                        type: 'firsttab',
                        prompt: '文章标题不能为空'
                    }, {
                        type: 'firstmaxlength',
                        prompt: '文章标题不能超过50个字'
                    }]
                },
                articalauthor: {
                    identifier: 'articalauthor',
                    rules: [{
                        type: 'firsttab',
                        prompt: '文章作者不能为空'
                    }, {
                        type: 'firstmaxlength',
                        prompt: '文章作者不能超过50个字'
                    }]
                },
                add_tempalte: {
                    identifier: 'add_tempalte',
                    rules: [{
                        type: 'firsttabrichcontent',
                        prompt: '文章内容不能为空'
                    }]
                },
                articalurl: {
                    identifier: 'articalurl',
                    rules: [{
                        type: 'firsttaburl',
                        prompt: '链接格式不正确'
                    }]
                },
                secondfilename: {
                    identifier: 'secondfilename',
                    rules: [{
                        type: 'secondtab',
                        prompt: '文件名称不能为空'
                    }, {
                        type: 'secondmaxlength',
                        prompt: '文件名称不能超过50个字'
                    }]
                },
                // fileup: {
                //     identifier: 'fileup',
                //     rules: [{
                //         type: 'file_exist',
                //         prompt: '文件不能为空'
                //     }]
                // },
                thirdarticaltitle: {
                    identifier: 'thirdarticaltitle',
                    rules: [{
                        type: 'thirdtab',
                        prompt: '文章标题不能为空'
                    }, {
                        type: 'thirdmaxlength',
                        prompt: '违章标题不能超过50个字'
                    }]
                },
                thirdarticalurl: {
                    identifier: 'thirdarticalurl',
                    rules: [{
                        type: 'thirdtab',
                        prompt: '外部链接不能为空'
                    }, {
                        type: 'thirdtaburl',
                        prompt: '外部链接格式错误'
                    }]
                }
            }
        });

        $('#FirstKnowLedge_id').form({
            on: 'blur',
            inline: true,
            fields: {
                editarticaltitle: {
                    identifier: 'editarticaltitle',
                    rules: [{
                        type: 'empty',
                        prompt: '文章标题不能为空'
                    }, {
                        type: 'maxLength[50]',
                        prompt: '标题内容不能超过50个字'
                    }]
                },
                editarticalauthor: {
                    identifier: 'editarticalauthor',
                    rules: [{
                        type: 'empty',
                        prompt: '文章作者不能为空'
                    }, {
                        type: 'maxLength[50]',
                        prompt: '文章作者不能超过50个字'
                    }]
                },
                edit_tempalte: {
                    identifier: 'edit_tempalte',
                    rules: [{
                        type: 'editfirsttabrichcontent',
                        prompt: '文章内容不能为空'
                    }]
                },
                editfirsttaburl: {
                    identifier: 'editfirsttaburl',
                    rules: [{
                        type: 'edittaburl',
                        prompt: '链接格式不正确'
                    }]
                }
            }
        });

        $('#SecondEditKnowLedge_id').form({
            on: 'blur',
            inline: true,
            fields: {
                editsecond: {
                    identifier: 'editsecond',
                    rules: [{
                        type: 'empty',
                        prompt: '文件名字不能为空'
                    }, {
                        type: 'maxLength[50]',
                        prompt: '文件名称不能超过50个字'
                    }]
                }
            }
        });


        $('#ThirdEditKnowLedge_id').form({
            on: 'blur',
            inline: true,
            fields: {
                editthirdarticaltitle: {
                    identifier: 'editthirdarticaltitle',
                    rules: [{
                        type: 'empty',
                        prompt: '文章标题不能为空'
                    }, {
                        type: 'maxLength[50]',
                        prompt: '标题内容不能超过50个字'
                    }]
                },
                // editthirdarticalabstract: {
                //     identifier: 'editthirdarticalabstract',
                //     rules: [{
                //         type: 'empty',
                //         prompt: '文章摘要不能为空'
                //     }]
                // },
                editthirdarticalurl: {
                    identifier: 'editthirdarticalurl',
                    rules: [{
                        type: 'url',
                        prompt: '链接格式不正确'
                    }]
                }
            }
        })

        function registerHiddenBlur(hiddenID, visibleID) {
            $('#' + visibleID).blur(function() {
                //延时触发blur，目的是让hidden input先于blur被赋值
                setTimeout(function() {
                    $('#' + hiddenID).trigger('blur');
                }, 100);
            });
        }
    });
</script>